package cn.legend.travel.admin.content.dao.persist.repository.impl;

import cn.legend.travel.admin.content.dao.persist.mapper.BannerMapper;
import cn.legend.travel.admin.content.dao.persist.repository.IBannerRepository;
import cn.legend.travel.admin.content.pojo.entity.Banner;
import cn.legend.travel.admin.content.pojo.param.BannerParam;
import cn.legend.travel.admin.content.pojo.vo.BannerVO;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@RequiredArgsConstructor
public class BannerRepositoryImpl implements IBannerRepository {
    private final BannerMapper bannerMapper;

    @Override
    public List<BannerVO> getBannerList() {
        return bannerMapper.getBannerList();
    }

    @Override
    public int update(BannerParam param) {
        Banner banner = new Banner();
        BeanUtils.copyProperties(param, banner);
        return bannerMapper.updateById(banner);
    }
}
